class Animal {
  constructor(name) {
    this.name = name;
  }

  speak() {
    console.log(`${this.name} makes a noise.`);
  }
}

class Dog extends Animal {
  constructor(name, breed) {
    console.log(this);
    
    // super(name); // 调用父类的构造函数
    this.name=name
    this.breed = breed;
  }

  bark() {
    console.log(`${this.name} barks!`);
  }
}

const myDog = new Dog("Rex", "German Shepherd");
myDog.speak(); // 输出: Rex makes a noise.
myDog.bark(); // 输出: Rex barks!
